class Admin::CategoriesController < Admin::ApplicationController
  before_action :find_category, only: %i{edit update destroy}

  def new
    @category = Category.new
  end

  def create
    @category = Category.new params.require('category').permit(:name, :slug)
    @category.save
  end

  def edit

  end

  def update
    @category.update params.require('category').permit(:name, :slug)
  end

  def destroy
    @category.destroy
  end

  private
  def find_category
    @category = Category.find params[:id]
  end
end
